- 
                Notifications
    You must be signed in to change notification settings 
- Fork 837
Add dedicated instant/range query handlers #6763
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add dedicated instant/range query handlers #6763
Conversation
721af3a    to
    5c890a8      
    Compare
  
            
          
                pkg/api/custom_api.go
              
                Outdated
          
        
      | } | ||
|  | ||
| // Custom handler for Query range API | ||
| func (c *CustomAPI) rangeQueryHandler(r *http.Request) (result apiFuncResult) { | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would suggest we move query handlers implementation to its own package in pkg/querier.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can think of reusing this in queryfrontend in the future. Can we keep in pkg/api/query?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not a blocker for this PR. Should we do this for all routes like Thanos does?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@SungJin1212 Can we change the file path as Harry suggested?
98f5859    to
    8007a94      
    Compare
  
    | There is an issue in the test. I'm fixing. | 
fed32aa    to
    b2820ce      
    Compare
  
    | @yeya24 | 
835cfee    to
    062bc9b      
    Compare
  
    062bc9b    to
    2e95f38      
    Compare
  
    2e95f38    to
    b0871cb      
    Compare
  
    | 
 @SungJin1212 Thanks for this. It is ok for now. I wonder if it makes more sense if we keep the original parse function which returns basic errors in the API code. And query frontend handler can import those functions and wrap with gRPC errors instead. This way seems cleaner and we don't have to respond with gRPC errors in the query API handler | 
| 
 Yeah, I think it would be better if the query API could emit a basic error. But can I do that in the next refactoring PR? It seems that many codes need to be changed. | 
d9379b5    to
    6a6ca74      
    Compare
  
    There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. This LGTM. Let's at least get another approval before merging it
| 
 We should probably do something to fix the OOM kill | 
| @@ -0,0 +1,249 @@ | |||
| package queryapi | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be in the api package?
Here's how Thanos does this for a reference.
https://github.com/thanos-io/thanos/tree/main/pkg/api
6a6ca74    to
    9445d27      
    Compare
  
    | I think this make sense! i would just reference the prometheus query handler on query api file so we know from where it was based of, so we can easily bring new thing that are added there. | 
| Why do only for query though? if we are doing this is not better to do for everything? (GetLabelsNames/Values for instance as well?) | 
| 
 We can do it in the future. I don't see any requirement to implement other APIs today. | 
Signed-off-by: SungJin1212 <[email protected]>
9445d27    to
    0f50d21      
    Compare
  
    
This PR adds dedicated instant/range query handlers to customize these APIs.
Which issue(s) this PR fixes:
Fixes #6754
Checklist
CHANGELOG.mdupdated - the order of entries should be[CHANGE],[FEATURE],[ENHANCEMENT],[BUGFIX]